{extends file='layout/front.html'}

{block name='headApend'}
<link href="{$config_site_url}style/weibo.css" rel="stylesheet" type="text/css">
<link href="{$config_site_url}style/fixed.css" rel="stylesheet" type="text/css">
{/block}

{block name='main'}
<script type="text/javascript" charset="utf-8">
$('.menu1').attr('class', 'menu1_cur');
</script>
<script type="text/javascript" charset="utf-8" src="{$config_site_url}js/weibo.js"></script>
<div class="main_fixed">
<div class="main_t">

</div>
<div class="main_t2">


	<script type="text/javascript" charset="utf-8">
	 $('.tab_1 a').click(function(){
	   if (timeline_lock) {
       return false;
     }
	   $('#weibo_bag').empty();
	   feature = $(this).index('.tab_1 a');
	   
	   load_timeline(0, true);
	   $('.tab_1 a').removeClass('current');
	   $(this).addClass('current');

	   return false;
	 });

	 $('.header,.header_user').wrapAll('<div class="header_fixed" />');
	 
	 $('.main_tab a').click(function(){
	   var index = $(this).index('.main_tab a');
	   $('#weibo_bag').empty();
	   
	   if (index == 0) {
	     friends = 0;
	     followers = 0;
	     comments_to_me = 0;
	     $('.tab_2').hide();
	     $('.tab_1').show();
	     mention = 0;
	     user_id = 0;
	   } else if (index == 1) {
	     friends = 0;
	     followers = 0;
	     comments_to_me = 0;
	     $('.tab_2').hide();
	     $('.tab_1').show();
	     mention = 0;
	     user_id = {$weibo_info.id};
	   } else if (index == 2) {
	     friends = 0;
	     followers = 0;
	     comments_to_me = 0;
	     $('.tab_2').show();
	     $('.tab_1').hide();
	     mention = 1;
	     user_id = 0;
	   } else if (index == 3) {
	     friends = 0;
	     followers = 0;
	     comments_to_me = 1;
	     $('.tab_2').show();
	     $('.tab_1').hide();
	     mention = 0;
	     user_id = 0;
	   } else if (index == 4) {
	     friends = 0;
	     followers = 1;
	     comments_to_me = 0;
	     $('.tab_2').show();
	     $('.tab_1').hide();
	     mention = 0;
	     user_id = {$weibo_info.id};
	   } else if (index == 5) {
	     friends = 1;
	     followers = 0;
	     $('.tab_2').show();
	     $('.tab_1').hide();
	     mention = 0;
	     user_id = {$weibo_info.id};
	   }

     load_timeline(0, true);
	   $('.main_tab a').removeClass('current');
	   $(this).addClass('current');

	   return false;
	 });
	</script>
</div>
</div>
<div class="main_c">
<!--weibo start-->
<div class="weibo_blk">
<div node-type="feed_list" pagenum="1" class="feed_lists W_linka W_texta" id="weibo_bag">
  

	{foreach $t_data as $val}
	
		<dl action-type="feed_list_item" mid="{$val.id}" class="feed_list ">
			<dt class="face"> <a title="{$val.user.screen_name}" href="weibo/{$val.user.id}.html"><img width="50" height="50" src="{$val.user.profile_image_url}" title="{$val.user.screen_name}" usercard="id=1740577714"></a> </dt>
			<dd class="content">
				<p node-type="feed_list_content"> <a usercard="id=1740577714" href="weibo/{$val.user.id}.html" title="{$val.user.screen_name}" nick-name="{$val.user.name}"> {$val.user.screen_name}</a>{if $val.user.verified}<a href="http://weibo.com/verify" target="_blank"><img class="approve_co" alt="新浪机构认证" title="新浪机构认证" src="http://img.t.sinajs.cn/t4/style/images/common/transparent.gif"></a>{/if}：<em>{$val.text}</em></p>
				{if isset($val.thumbnail_pic)}
				<ul node-type="feed_list_media_prev" class="piclist">
					<li> <img action-type="feed_list_media_img" src="{$val.thumbnail_pic}" class="bigcursor" /><img class="loading_gif" src="http://img.t.sinajs.cn/t4/style/images/common/loading.gif" style="left: 39.5px; top: 52px;"> </li>
				</ul>
				{/if}
				{if isset($val.retweeted_status)}
				<dl class="comment">
	       <dd class="arrow"><span>◆</span></dd>
	       <dt node-type="feed_list_forwardContent"> <a usercard="id=2348963387" title="{$val.retweeted_status.user.screen_name}" href="weibo/{$val.retweeted_status.user.id}.html" nick-name="{$val.retweeted_status.user.screen_name}"> @{$val.retweeted_status.user.screen_name}</a>{if $val.retweeted_status.user.verified}<a href="http://weibo.com/verify" target="_blank"><img class="approve_co" alt="新浪机构认证" title="新浪机构认证" src="http://img.t.sinajs.cn/t4/style/images/common/transparent.gif"></a>{/if}：<em>{$val.retweeted_status.text}</em> </dt>
	       <dd node-type="feed_list_media_prev">
	         {if isset($val.retweeted_status.thumbnail_pic)}
	         <ul class="piclist">
	           <li> <img action-type="feed_list_media_img" src="{$val.retweeted_status.thumbnail_pic}" class="bigcursor" /><img class="loading_gif" src="http://img.t.sinajs.cn/t4/style/images/common/loading.gif" style="left: 39.5px; top: 52px;"> </li>
	         </ul>
	         {/if}
	       </dd>
	       <dd node-type="feed_list_media_disp" style="display: none;" class="expand"></dd>
	       <dd class="info W_linkb W_textb"><span>
			<a href="show.html?id={$val.retweeted_status.id}">
				转发({$val.retweeted_status.counts.rt})</a>
				<i class="W_vline">|</i><a href="show.html?id={$val.retweeted_status.id}" >评论({$val.retweeted_status.counts.comments})</a>
				</span><a href="show.html?id={$val.retweeted_status.id}" class="date realTime">{strtotime($val.retweeted_status.created_at)}</a>
				 来自{$val.retweeted_status.source}</dd>
	     </dl>
	     {else}
	     	<dl node-type="feed_list_media_disp" style="display: none;" class="comment"></dl>
				{/if}
				<p class="info W_linkb W_textb"> <span> <a action-data="{$val.id}" action-type="feed_list_forward" href="javascript:void(0);">转发({$val.counts.rt})</a><i class="W_vline">|</i> <a action-type="feed_list_comment" action-data="{$val.id}" href="javascript:void(0);">评论({$val.counts.comments})</a> </span> <a node-type="feed_list_item_date" class="date realTime"  href="javascript:void(0);">{strtotime($val.created_at)}</a> 来自{$val.source} </p>
				<div style="display:none;" class="repeat" node-type="feed_list_repeat"></div>
			</dd>
			<dd class="clear"></dd>
		</dl>
	{/foreach}
	<script type="text/javascript" charset="utf-8">
	var lock = true;
	var  page = 1;
	append_comment_input();
	load_feed_list_comment();
	$(window).scroll(function(){
	  if ($(this).height()+$(this).scrollTop() >= $(document).height()-2) {
	        load_feed_list_comment();
	  }
	});
	
	function append_comment_input () {
		var data =  '<div class="arrow"><span>◆</span></div>\
		<div class="input clearfix" node-type="commentList">\
			<div>\
			<textarea node-type="textEl" rows="" cols="" action-type="check" style="margin: 0px 0px 3px; padding: 4px 4px 0px; border-color: rgb(198, 198, 198); border-style: solid; border-width: 1px; font-size: 12px; font-family: Tahoma,宋体; word-wrap: break-word; line-height: 18px; overflow: hidden; outline: medium none; height: 20px;" id="tweet_content"></textarea>\
			</div>\
		  <div node-type="widget" class="action clearfix">\
		    <!-- <span node-type="smileyBtn" alt="表情" title="表情" class="faces"></span> -->\
					<div class="post_btn"> <a href="#" class="ico1">表情</a>\
						<div class="post_win" style="left:-30px;display:none">\
							<div class="post_win_t"></div>\
							<a href="#" class="close">关闭</a>\
							<div class="post_win_tab clearfix"><a href="#" class="current loding">loading...</a></div>\
						</div>\
					</div>\
		  <ul class="commoned_list">\
		    	<li>\
		  	<label>\
		    	<input type="checkbox" name="forward" class="W_checkbox">同时转发到我的微博\
		    </label>\
		  </li>\
		  </ul>\
			</div>\
			<p class="btn">\
		  	<a action-data="{$id}" href="#" action-type="post" class="W_btn_b btn_noloading"><span><b class="loading"></b><em node-type="btnText">评论</em></span></a>\
			</p>\
		</div>';
		var html = $('a[action-type=feed_list_comment]');
		var rpl_div = html.parents('dl').find('div.repeat');
		rpl_div.show();
		rpl_div.html(data);
     
	};
	

	
	
	function load_feed_list_comment() {
		var html = $('a[action-type=feed_list_comment]');
		 var id = html.attr('action-data');
	     var rpl_div = html.parents('dl').find('div.repeat');
		if (lock) {
			lock = false;
			rpl_div.append('<div class="W_loading" node-type="lazyload"><span>正在加载中，请稍候...</span></div>').show();
			$.get(SITE_URL+'/ajax/reply.html?id='+id+'&page='+page, function(data){
				if (data) {
					rpl_div.append(data);
					lock = true;
					$('.W_loading').remove();
					page++;
				}else{
					$('.W_loading').remove();
					lock = false;
				};

			});
		};
      //rpl_div
	};
	
	
	$('a[action-type=post]').click(function(){
	    var id = $(this).attr('action-data');
	    var p = $(this).parents('div.repeat');
	    var c = p.find('textarea');
	    var cb = p.find('input[name=forward]');
	    if (!c.val()) {
	      show_msg('请输入内容', function(){
	        c.focus();
	      });
	      return false;
	    }
	    loading();
		lock = false;
		page = 2;
	    var item = 0;
	    if (cb.is(':checked')) {
	        item = 1;
	    }
	    $.post(SITE_URL + '/ajax/reply/commit.html', { id:id, con:c.val(), item:item}, function(data){
	        loading('off');
	        p.html('<div class="W_loading" node-type="lazyload"><span>正在加载中，请稍候...</span></div>').show().load(SITE_URL+'/ajax/reply.html?id='+id, function(){
				lock = true;
			});
		});
	    return false;
  	});
	
	
	
	  $('a.realTime').each(function(){
	    $(this).html(realTime.outPut($(this).html()));
	    $(this).removeClass('realTime');
	  });


	

	

	

	  $('.bigcursor').load(function(){
	    $(this).next().hide();
	  }).click(function(){
	    var feed_list = $(this).parents('dl').find('*[node-type=feed_list_media_disp]');
	    var self = $(this);
	    self.next().show();
	    var pic = self.attr('src').replace('thumbnail', 'bmiddle');
	    var img = $('<img />');
	    img.attr('src', pic);
	    img.load(function(){
	      self.next().hide();
	      self.parents('*[node-type=feed_list_media_prev]').hide();

	      feed_list.show();

	      if (feed_list.is('dl')) {
	        feed_list.append('<dd class="expand"></dd>');
	        feed_list = feed_list.find('dd');
	      }
	        feed_list.html('<p class="W_no_border">\
	            <a class="retract" href="javascript:void(0);" action-type="feed_list_media_toSmall">收起</a><i class="W_vline">|</i>\
	            <a class="show_big" target="_blank" href="'+self.attr('src').replace('thumbnail', 'large')+'">查看大图</a><i class="W_vline">|</i>\
	            <a class="turn_left" href="javascript:void(0);" action-type="feed_list_media_toLeft">向左转</a><i class="W_vline">|</i>\
	            <a class="turn_right" href="javascript:void(0);" action-type="feed_list_media_toRight">向右转</a>\
	          </p>\
	          <div action-type="feed_list_media_bigimgDiv" class="smallcursor">\
	            <img width="440" maxWidth="440" src="'+pic+'" action-type="feed_list_media_bigimg" />\
	          </div>').find('.retract').click(function(){
	          $(this).parents('dl').find('*[node-type=feed_list_media_disp]').empty().hide();
	          self.parents('*[node-type=feed_list_media_prev]').show();
	        });

	        feed_list.find('.smallcursor').click(function(){
	          feed_list.find('.retract').click();
	        });
	        feed_list.find('.turn_left').click(function(){
	          $('img[action-type=feed_list_media_bigimg]', feed_list).rotate('left');
	        });
	        feed_list.find('.turn_right').click(function(){
	          $('img[action-type=feed_list_media_bigimg]', feed_list).rotate('right');
	        });
	    });
	  });

		
		
		$('a[action-type=feed_list_forward]').click(function(){
		    var id = $(this).attr('action-data');
		    var text = $(this).parents('dl').find('p[node-type=feed_list_content] em').html();
		    var user_name = $(this).parents('dl').find('p[node-type=feed_list_content] > a').html();

		    retweet_box(text, id, user_name);

	    	return false;
	  	});
	</script>








</div>
</div>
<script type="text/javascript" charset="utf-8">
$('.main_min_tab a:eq(0)').click();


</script>
<!--weibo end--> 
</div>
{/block}